<?php
  $link = mysql_connect('', 'admin_xbq', 'nihao')
      or die('Could not connect: ' . mysql_error());
  echo "Connected successfully\n";
  echo '<br /><br />';

  $query = "use test";
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  $sql = "select * from user where user.user_ID=".$_GET['user_id'];
  $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
  $line = mysql_fetch_array($result, MYSQL_ASSOC);
?>

<form action="edit_confirm3.php?user_id=<?php echo $line['user_ID'];?>" method="post">
  <table align="center" width="400">
    <tr>
      <td class="style3">User ID:</td>
      <td align="right" class="style3">
        <input width="100" name="id" type="text" value="<?php echo $line['user_ID'];?>" />
      </td>
    </tr>
    <tr>
      <td class="style3">Staff room ID:</td>
      <td align="right" class="style3">
        <input width="100" name="s_id" type="text" value="<?php echo $line['sr_ID'];?>" />
      </td>
    </tr>
    <tr>
      <td class="style3">User name:</td>
      <td align="right" class="style3">
        <input name="user_name" type="text" value="<?php echo $line['user_name'];?>" />
      </td>
    </tr>
    <tr>
      <td class="style3">Login:</td>
      <td align="right" class="style3">
        <input name="login" type="text" value="<?php echo $line['login'];?>" />
      </td>
    </tr>
    <tr>
      <td class="style3">Password:</td>
      <td align="right" class="style3">
        <input  name="password" type="text" value="<?php echo $line['password'];?>" />
      </td>
    </tr>
    <tr>
      <td class="style3">User type:</td>
      <td align="right" class="style3">        
        <select name="type" value="<?php echo $line['user_type'];?>" >
          <option value="t"> Teacher </option>
          <option value="s"> Head of staff room </option>
          <option value="d"> Head of department </option>
          <option value="r"> Rector </option>
        </select>
      </td>
    </tr>
    <tr>
      <td class="style3">User duty:</td>
      <td align="right" class="style3">
        <select name="duty" value="<?php echo $line['user_duty'];?>" >
          <option value="Professor"> Professor </option>
          <option value="Associate professor"> Associate professor </option>
          <option value="Old teacher"> Old teacher </option>
          <option value="Assistant"> Assistant </option>
        </select>
      </td>
    </tr>
    <tr>
      <td class="style3">User phone:</td>
      <td align="right" class="style3">
        <input name="phone" type="text" value="<?php echo $line['phone'];?>" />
      </td>
    </tr>
    <tr>
      <td class="style3">User e-mail:</td>
      <td align="right" class="style3">
        <input name="email" type="text" value="<?php echo $line['email'];?>" />
      </td>
    </tr>
    <tr>
      <td class="style3" align="right"><input name="add" type="button" value="Reset" /></td>
      <td align="left" class="style3"><input name="add" type="submit" value="Save" /></td>
    </tr>
  </table>
</form>
